package com.gee.spring.boot.rpf.client.xuexin;

import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONConverter;
import cn.hutool.json.JSONUtil;
import com.gee.spring.boot.rpf.client.AbstractClient;
import com.gee.spring.boot.rpf.client.exicr2.ExiCr2Client;
import com.gee.spring.boot.rpf.common.constant.ClientConstant;
import com.gee.spring.boot.rpf.entity.Client;
import com.gee.spring.boot.rpf.util.CommonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.util.StringJoiner;

/**
 * desc:
 *
 * @author gee wrote on  2020-10-15 15:57:13
 */
@Component
@Scope("prototype")
public class XueXinClient extends AbstractClient<XueXinRequest, XueXinResponse> {

    private final Logger logger = LoggerFactory.getLogger(XueXinClient.class);
    @Override
    public String getCacheKey(XueXinRequest req) {
        return CommonUtil.buildRequestCacheKey(req.getCertId(),req.getCstName(),req.getMblNo());
    }

    @Override
    public XueXinResponse call(XueXinRequest clientRequest) throws Exception {
        Thread.sleep(1000);
        /*String response = HttpUtil.post("xuexinUrl", JSONUtil.parseObj(clientRequest));
        JSONUtil.toBean(response, GzAddrResponse.class);
        */
        XueXinResponse response = new XueXinResponse();
        response.setCode("000000");
        response.setMsg("调用成功");
        response.setEduGrade("10");
        return response;
    }
}
